package cn.com.ht.jdbctemplate.jdbctemplate_more.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.jdbc.core.JdbcTemplate;

import java.util.List;
import java.util.Map;

@org.springframework.stereotype.Service
public class Service {


    @Autowired
    @Qualifier("primaryJdbcTemplate")
    public JdbcTemplate jdbcPrimaryTemplate;

    @Autowired
    @Qualifier("secondaryJdbcTemplate")
    public JdbcTemplate jdbcSecondaryTemplate;


    public List<Map<String,Object>> getData(){
        String sql = "select * from demo1";
        return jdbcPrimaryTemplate.queryForList(sql);
    }

    public List<Map<String,Object>> getData1(){
        String sql = "select * from demo2";
        return jdbcSecondaryTemplate.queryForList(sql);
    }


}
